<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Room Management</title>
<script src="../js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="../js/jquery.validate.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript">
  $(document).ready(function() {
	  jQuery.ajax({
		     type:"POST",
		     url:"../jsp/Room-Management.jsp",
		     success:function(html){
		      //jQuery("#responseDiv").text(html);
		      var response = $(html);
		      $("#getAllRoom").html(response.filter('#getAllRoom').html());
			  $("* #Update").click(function() {
				  var roomID = $(this).attr('name');
				  alert(roomID);
				  jQuery.ajax({
					     type:"POST",
					     url:"../jsp/Update-Session.jsp",
					     data:{
					    	 roomID : roomID
					     },
					     success:function(html){
					    	 window.location='Edit-Room.html';
					     }
					    });
			  });
			  $("* #Delete").click(function() {
				  var answer = confirm("Do you realy want to delete this room?");
				  if(answer){
				  	var roomID = $(this).attr('name');
				  	alert(roomID);
				  	jQuery.ajax({
						  type:"POST",
					      url:"../deleteRoomService",
					      data:{
					    	  roomID : roomID
					      },
					      success:function(html){
					    	  window.location='Room-Management.html';
					      }
					});
				  }
			  });
		     }
		    });
  });
</script>
</head>
<body>
	<h1>Room Management</h1>
	<div id="getAllRoom"></div>					
</body>
</html>